package org.proddevplm.business.diagram;

import java.util.HashMap;
import java.util.Map;

import org.proddevplm.business.api.IAdapter;
import org.proddevplm.business.diagram.constants.DiagramConstans;
import org.proddevplm.helpers.ManagerUtil;

public class DiagramAdapter implements IAdapter{

	@Override
	public Object adapt(int command, Map<String, Object> dataObject) {
		
		Object adaptedObject = null;
		Map<String, Object> diaMap = new HashMap<String, Object>();
		
		switch(command){
		
		case DiagramConstans.SAVE_DIA:
			diaMap.put("diaEncoding", ManagerUtil.getStringFromReq(dataObject.get("diaEncoding")));
			
			adaptedObject = diaMap;
			break;
		
		case DiagramConstans.UPDATE_DIA:
			diaMap.put("diaEncoding", ManagerUtil.getStringFromReq(dataObject.get("diaEncoding")));
			
			adaptedObject = diaMap;
			break;
			
		}
		return adaptedObject;
	}

}
